import java.util.Comparator;
import java.util.Map;

public class KeyComparator implements Comparator<String>{
    private Map<String, Integer> value;
      
    public KeyComparator(Map<String, Integer> value){
        this.value = value;
    }

	public int compare(String key1, String key2) {
		Integer value1 = value.get(key1);
		Integer value2 = value.get(key2);
		return value2-value1;
	}
}